LoginPanel={};
local this=LoginPanel;

--大家统一叫new
function LoginPanel.New()
    panelMgr:CreatePanel("Login",nil);
end
function LoginPanel.OnCreate(go)
end

function LoginPanel.OnClick()
    log(this.username.text);

    HallPanel.New();
    panelMgr:ClosePanel('Login');
end

-----------------------------

function LoginPanel.Awake(go)
    log("LoginPanel.Awake");
    this.gameObject=go;
    this.transform=go.transform;
    local behavior=this.transform:GetComponent('LuaBehaviour');

    this.username = this.transform:Find("UserName"):GetComponent('InputField');
    this.password = this.transform:Find("PassWord"):GetComponent('InputField');
    
    -----------------------------Button绑定事件--------------------------------
    --1.
    -- this.loginBtn = this.transform:Find("LoginBtn"):GetComponent('Button');
    -- this.loginBtn.onClick:AddListener(this.OnClick);

    --2.
    this.loginBtn = this.transform:Find("LoginBtn").gameObject;
    behavior:AddClick(this.loginBtn,this.OnClick);

    -----------------------------Slider绑定事件--------------------------------
    --1.
    -- this.slider=this.transform:Find("Slider").gameObject;
    -- behavior:AddSlider(this.slider,this.OnSliderChange);

    --2.
    this.slider=this.transform:Find('Slider'):GetComponent('Slider');
    this.slider.onValueChanged:AddListener(function(value)
        print(value);
    end);
end


function LoginPanel.OnSliderChange(value)
    print("value:"..value);
end

function LoginPanel.Start()
    log("LoginPanel.Start");
end